﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MiddleCollection.Models
{
    /// <summary>
    /// 响应实体类
    /// </summary>
    public class ResultModel
    {
        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="data">返回数据</param>
        /// <returns></returns>
        public static TResponse Ok(object data)
        {
            return new TResponse<object> { Data = data, Message = null, Code = 1 };
        }
        /// <summary>
        /// 失败
        /// </summary>
        /// <param name="str">错误信息</param>
        /// <param name="code">状态码</param>
        /// <returns></returns>
        public static TResponse Error(string str, int code)
        {
            return new TResponse { Success = 0, Message = str, Code = code };
        }
    }
}
